package marek.barak.classes;
import java.io.Serializable;
import java.util.Map;


import marek.barak.exceptions.InvalidActionValueException;


public class Action implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = -7713139362655137540L;
	private String name;
	private Map<Integer,Integer> time;
	
	public Action(String name,Map<Integer,Integer> t)throws InvalidActionValueException{
		if(name == null || name.length()==0)
			throw new InvalidActionValueException("Name for action is missing");
		if(t==null || t.size()==0){
			throw new InvalidActionValueException("Add action first");
		}
		this.name = name;
		this.time = t;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Override
	public String toString(){
		return name;
	}
	
	@Override
	public boolean equals(Object a){
		if(a instanceof Action){
			if(((Action)a).getName().equals(this.getName()))
			return true;
			else return false;
		}else
			return false;
		
	}

	public void setTime(Map<Integer,Integer> time)throws InvalidActionValueException {
		if(time==null || time.size()==0)
			throw new InvalidActionValueException("Add actions first");
		this.time = time;
		
	}
	
	public Map<Integer,Integer> getTime(){
		return this.time;
		
	}
	public ActionMade getInstanceActionMade(int amounth){
		
		
		
		return null;
	}
	
};



